#include <QApplication>
#include <QQmlApplicationEngine>
#include "facevideopainteditem.h"
#include "facevideoitem.h"
#include "faceaction.h"
#include "cameravideobuffer.h"

#include <QQmlApplicationEngine>
#include <QGuiApplication>
#include <QtQml/qqml.h>

// First, define the singleton type provider function (callback).
static QObject* CameraVideoBufferSingleton(QQmlEngine *engine, QJSEngine *scriptEngine)
{
    Q_UNUSED(engine)
    Q_UNUSED(scriptEngine)

    CameraVideoBuffer *cambuf = new CameraVideoBuffer(NULL);
    return cambuf;
}

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QQmlApplicationEngine engine;
    qmlRegisterType<FaceVideoPaintedItem>("com.hanvon.face",1,0,"FaceVideoPaintedItem");
    qmlRegisterType<FaceVideoItem>("com.hanvon.face",1,0,"FaceVideoItem");
    qmlRegisterType<FaceAction>("com.hanvon.face",1,0,"FaceAction");

    //qmlRegisterSingletonType<CameraVideoBuffer>("com.hanvon.face",1,0,"CameraVideoBuffer",CameraVideoBufferSingleton);
    qmlRegisterType<CameraVideoBuffer>("com.hanvon.face",1,0,"CameraVideoBuffer");
    qmlRegisterType<FaceAction>("com.hanvon.face",1,0,"FaceAction");
    engine.load(QUrl(QStringLiteral("qrc:///main.qml")));

    return app.exec();
}
